/*
    Project:        Home Power Control
    File:           HPCLogFile.cpp
    Author:         christian@karunamusic.at
    Date:           12.2014
    Description:    Log to file.
 */

#include "HPCLogFile.h"

using namespace std;

HPCLogFile::HPCLogFile( TLogLevel lv, const string& fn ) : HPCLogDevice(lv)
{
    m_Out.open( fn.c_str(), ios::app );
}

HPCLogFile::~HPCLogFile()
{
    m_Out.close();
}

void HPCLogFile::OnLog( const HPCLogMessage& lm )
{
    if ( lm.LogLevel() <= LogLevel() )
        m_Out << lm << endl;
}
